package com.it.reggie.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//配置分页插件//大大地简化分页查询的代码量
@Configuration//
public class MybatisPlusConfig {
    //通过拦截器，把插件加进来
    @Bean//让spring来管理他
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();//创建拦截器对象
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());//加入拦截器插件Pagination..是由mybatis提供的

        return mybatisPlusInterceptor;
    }
}
